package pl;

import java.io.IOException;

import org.antlr.runtime.ANTLRFileStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;

import pl.grammar.Analex;
import pl.grammar.Anasin;

public class P5 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		if (args.length < 1 && args.length > 2)
		{
			System.err.println("Numero de parametros incorrecto.");
			return;
		}

		ANTLRFileStream stream = null;
		try {
			stream = new ANTLRFileStream(args[0]);
		} catch (IOException e) {
			e.printStackTrace();
		}
		Analex analex = null;
		analex = new Analex(stream);
	
		// definicion del analizador sintactico
		CommonTokenStream tokens = new CommonTokenStream(analex);
		Anasin anasin = null;
		anasin = new Anasin(tokens);
		try {
			anasin.flex();
		} catch (RecognitionException e) {
			e.printStackTrace();
		}

	}

}
